using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ExceptionExample{
    public partial class Form1 : Form{
        public Form1(){
            InitializeComponent();
        }
        private void button1_Click(object sender,EventArgs e){
            int a,b,c;
            try{
                a = Convert.ToInt32(textBox1.Text);
                b = Convert.ToInt32(textBox2.Text);
                if(a<-1000 || a>1000)
                    throw new IndexOutOfRangeException("your input is"+a);
                if(b<-1000 || b>1000)
                    throw new IndexOutOfRangeException("your input is"+b);
                c = a/b;
                label.Text = "the answer is "+c;
            }catch(FormatException){
                label3.Text = "Your input is not number";
            }catch(DivideByZeroException){
                lebel3.Text = "Divide By Zero";
            }catch(IndexOutOfRangeException ex){
                label3.Text = "Error,your input required between -1000 and 1000";
            }finally{
                MessageBox.Show(" normal termination ");
            }
        }
    }
}